import com.sun.org.apache.bcel.internal.generic.SWAP;

import java.util.Arrays;

public class FirstClass {

    public static void main1(String[] args) {
        System.out.println("hello");
    }

    public static void move(char pos1,char pos2) {
        System.out.print(pos1+"->"+pos2 +" ");
    }

    public static void honoi(int n,char pos1,char pos2,char pos3) {
        if(n==1) {
            move(pos1,pos3);
            return;
        }
        else {
            honoi(n-1,pos1,pos3,pos2);
            move(pos1,pos3);
            honoi(n-1,pos2,pos1,pos3);
        }
    }
    public static void main2(String[] args) {
        //汉诺塔问题
        honoi(3,'A','B','C');

    }


    public static void main3(String[] args) {
        /**
         * foreach循环
         * for循环遍历
         */
        int[] array =new int[]{1,2,3,4};
//        for(int x:array) {
//            System.out.print(x+" ");
//        }
          for(int i=0;i<array.length;++i) {
              System.out.print(array[i]+" ");
          }
    }

    /**
     * 实现两个数的交换；
     * @param args
     */
    public static void main4(String[] args) {
        int[] array =new int[]{1,6};
        //swap(array[0],array[1]);
        //以字符串的形式打印数组
        //交换数组中的两个元素
        //将数组中的元素扩大为2倍

    }

//    public static String myToString(int[] array) {
//        //先打印[  间隔要打印逗号
//        System.out.print("[");
//        for(int i=0;i<array.length;++i) {
//            System.out.println(array[i]+","+" ");
//        }
//        System.out.print("]");
//        return arrays;
//    }
    public static void main5(String[] args) {
       int[] array={1,5,8,9,3,7,5,3,7,0};
       //string ret =myToString(array);
        System.out.print("[");
        for(int i=0;i<array.length;++i) {
            System.out.print(array[i]);
            if(i== array.length-1) {
                break;
            } else {
                System.out.print(","+" ");
            }
        }
        System.out.print("]");
    }

    public static String myToString(int[] arrays) {
        String ret ="[";
        for(int i=0;i< arrays.length;++i) {
            ret+=arrays[i];
            if(i!= arrays.length-1)
                ret+=",";
        }
        ret+="]";
        return ret;
    }
    public static void main6(String[] args) {
        int[] array ={5,8,9,6,3,7,4,1,2,0};
        System.out.println(myToString(array));
    }
    //以字符串的形式打印数组
    //交换数组中的两个元素
    //将数组中的元素扩大为2倍
    public static void swap(int[] array1) {
        int tmp =array1[0];
        array1[0]=array1[1];
        array1[1]=tmp;
    }
    public static void printArray(int[] array1) {
        for(int x:array1){
            System.out.print(x+" ");
        }
    }
    public static void main7(String[] args) {
        //int[] array ={1,5,8,7,9,6,3,2,4};
        //int[] arrays =new int[]{1,2,5};
        int[] array1 ={1,2};
        printArray(array1);
        swap(array1);
        System.out.println();
        printArray(array1);
    }

    public static void main9(String[] args) {
        int[] array={1,5,8,9,7,6};
        System.out.println(Arrays.toString(array));
    }


}
